﻿using System.Collections;
using System.Drawing;

namespace OpenShape
{
    public abstract class Geometry
    {
        public class PointCollection : System.Collections.CollectionBase
        {
            internal PointCollection()
                : base()
            {
            }

            public PointF this[int index]
            {
                get
                {
                    return (PointF)((IList)this)[index];
                }
                set
                {
                    ((IList)this)[index] = value;
                }
            }

            public int Add(PointF p)
            {
                return this.List.Add(p);
            }

            public void AddRange(PointF[] ps)
            {
                this.InnerList.AddRange(ps);
            }
        }

        public class PartCollection : System.Collections.CollectionBase
        {
            internal PartCollection()
                : base()
            {
            }

            public int this[int index]
            {
                get
                {
                    return (int)((IList)this)[index];
                }
                set
                {
                    ((IList)this)[index] = value;
                }
            }

            public int Add(int p)
            {
                return this.List.Add(p);
            }
        }

        protected int m_id;
        protected int m_nNumParts;
        protected int m_nNumPoints;
        protected GeoRect m_Rect = new GeoRect();
        protected PartCollection m_pParts = new PartCollection();
        protected PointCollection m_pPoints = new PointCollection();

        public abstract int Id
        {
            get;
            set;
        }
        public abstract int NumParts
        {
            get;
            set;
        }
        public abstract int NumPoints
        {
            get;
            set;
        }

        public abstract PartCollection Parts
        {
            get;
        }
        public abstract PointCollection Points
        {
            get;
        }

        public abstract void SetRect(byte[] ByteArray);

        public abstract GeoRect MBR
        {
            get;
        }
    }
}
